<template>
	<view class="com-notice-list">
		<view class="com-notice-list__module" v-for="(item,index) in list" :key="index">
			<view class="com-notice-list__time">{{item.createTime|com-datetime}}</view>
			<view class="com-notice-list__main opactive-hover" :class="{'read-flag':!item.isRead}" @tap="itemToDetail(item)">
				<view class="com-notice-list__main-content">
					<view class="com-notice-list__main-content-title">{{item.title}}</view>
					<!-- <view class="com-notice-list__main-content-desc textHide-2">{{item.descn}}</view> -->
					<view class="com-notice-list__main-content-parse">
						<u-parse :content="item.descn"></u-parse>
					</view>
				</view>
				<view class="com-notice-list__main-btns">
					<text class="com-notice-list__main-btns__text">查看详情</text>
					<u-image width="32rpx" height="32rpx"
						src="https://file.casugn.com/storecompcard/static/img/direction／right@2x_1681780399615.png"></u-image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		options: {
			styleIsolation: 'shared', // 解除样式隔离
		},
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {

			}
		},
		methods: {
			itemToDetail(item) {
				this.$goToPage(`/pages/notice/detail?id=${item.id}`)
				this.$set(item, 'isRead', true)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.com-notice-list {
		padding-top: 16rpx;

		.com-notice-list__module {
			padding: 16rpx 32rpx;

			.com-notice-list__time {
				font-size: 24rpx;
				color: #86909C;
				line-height: 34rpx;
				text-align: center;
			}

			.com-notice-list__main {
				margin-top: 24rpx;
				background-color: #fff;
				border-radius: 16rpx;

				.com-notice-list__main-content {
					position: relative;
					padding: 24rpx;

					&::before {
						content: "";
						position: absolute;
						bottom: 0;
						left: 24rpx;
						right: 24rpx;
						border-bottom: 2rpx dashed #E5E6EB;
					}

					.com-notice-list__main-content-title {
						font-size: 28rpx;
						font-weight: 600;
						color: #1D2129;
						line-height: 40rpx;
					}

					.com-notice-list__main-content-desc {
						margin-top: 24rpx;
						font-size: 24rpx;
						color: #4E5969;
						line-height: 34rpx;
					}

					::v-deep.com-notice-list__main-content-parse {
						position: relative;
						// max-height: 72rpx;
						margin-top: 24rpx;
						font-size: 24rpx;
						color: #4E5969;
						line-height: 1.5;
						overflow: hidden;

						._ {
							overflow: hidden;
							text-overflow: ellipsis;
							word-break: break-all;
							display: -webkit-box;
							-webkit-line-clamp: 2;
							-webkit-box-orient: vertical;
						}

						image {
							max-width: 72rpx;
							max-height: 72rpx;
							object-fit: contain;
						}
					}
				}

				.com-notice-list__main-btns {
					padding: 24rpx;

					display: flex;
					justify-content: space-between;
					align-items: center;

					.com-notice-list__main-btns__text {
						font-size: 24rpx;
						color: #276AEE;
						line-height: 34rpx;
					}
				}
			}

			.read-flag {
				position: relative;

				&::before {
					content: "";
					position: absolute;
					top: 12rpx;
					right: 12rpx;
					width: 16rpx;
					height: 16rpx;
					background-color: #F53F3F;
					border-radius: 50%;
				}
			}
		}
	}
</style>
